/*
 * Copyright 2012 Focus Technology, Co., Ltd. All rights reserved.
 */
package com.coderonrails.cdistr.master.comint;

import com.coderonrails.cdistr.master.session.SlaveManager;

/**
 * MonitorThread.java
 * 
 * @author chenjianguo
 */
public class MonitorThread implements Runnable {
    public MasterServices server;

    public MonitorThread(MasterServices server) {
        this.server = server;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    @Override
    public void run() {
        while (server.isRunning()) {
            try {
                System.out.println("----------------- message --------------------");
                SlaveManager.getInstance().refreshSlave();
                System.out.println(SlaveManager.getInstance().getSlaveInfo());
                System.out.println("----------------------------------------------");
                System.out.println();
                System.out.println();
                Thread.currentThread().sleep(5000);
            }
            catch (Exception e) {
                e.printStackTrace();
                continue;
            }
        }
    }

}
